package com.fsnmt.maizhuanbao.utils;

import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.widget.Toast;

import java.security.spec.MGF1ParameterSpec;

/**
 * Created by Administrator on 2017/7/5.
 */

public class ToastUtils {
    public static boolean isShowCode = true;
    public static void show(Context context,int code,String text){
        String msg = (isShowCode?text+"("+code+")":text);
        if(null!=context)
            Toast.makeText(context,msg,Toast.LENGTH_SHORT).show();
    }
    public static void show(Context context,String text){
        if(null!=context) {
            Toast.makeText( context, text, Toast.LENGTH_SHORT).show();
        }
    }
    public static void show(final Context context, Handler mHandle, final String text){
        if(null!=context && null!=mHandle && !TextUtils.isEmpty(text)) {
            mHandle.post(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
}
